//
//  BasicTableView.m
//  haha
//
//  Created by crj on 2016/10/18.
//  Copyright © 2016年 陈荣建. All rights reserved.
//

#import "BasicTableView.h"

@interface BasicTableView()

{
    UIImageView *_noDataImageView;
}

@end

@implementation BasicTableView


- (void)drawRect:(CGRect)rect {
    // Drawing code
    if(!_noDataImageView){
        _noDataImageView = [[UIImageView alloc] init];
        _noDataImageView.image = [UIImage imageNamed:@"为空时"];
        [self.superview addSubview:_noDataImageView];
    }
}

- (void)layoutSubviews{
    [super layoutSubviews];
    _noDataImageView.frame = CGRectMake(0, 0, 150, 195);
    _noDataImageView.center = self.center;
    self.backgroundColor = [UIColor clearColor];
}


- (void)reloadData{
    [super reloadData];
    if(self.numberOfSections){
        if([self numberOfRowsInSection:0] == 0){
            _noDataImageView.hidden = NO;
        }else{
            _noDataImageView.hidden = YES;
        }
    }else{
        _noDataImageView.hidden = NO;

    }
}

@end
